<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <!-- lazy修饰符就是将input事件换成了change事件 -->
      <input type="text" v-model.lazy="msg" />
      <span>{{ msg }}</span>

      <hr />

      <!-- number修饰符是将input里面的值，尝试着转成数字类型 -->
      <input type="number" v-model.number="num" />
      <span>{{ typeof num }}</span>

      <hr />

      <!-- trim修饰符用于去除首尾空格 -->
      <input type="text" v-model.trim="str" />
      <p>{{ str }}</p>
      <button @click="fn">btn</button>
    </div>

    <script src="../Vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          msg: "hello",
          num: 5,
          str: "",
        },
        methods: {
          fn() {
            console.log(this.str);
          },
        },
      });
    </script>
  </body>
</html>
